#comments-start - More Info Dialog
[SCRIPT NAME]Copy Clipboard Files To Folder
Description:
    - Copies files from the clipboard to the specified destination folder.

Arguments:
    - Args1: Path to destination folder (Required) - e.g. C:\MyFiles
    - Args2: Overwrite existing files flag [Optional]
        - Options: (Combining values is allowed. e.g. 9 would give you functionality from both 1 & 8)
            - 0 = Do not overwrite existing files (Default)
            - 1 = Overwrite existing files
            - 8 = Create new directory and files but do not overwrite existing
#comments-end - More Info Dialog

#include <Include\WinClickPro.au3>
#include <Include\File.au3>

Func Main()
	Local $sFlag = 0 ; Default
	Local $sDest = ""

	;
	; This script has 1 required argument and 1 optional.
	;
	If $CmdLine[0] < 1 Then
		_DisplayErrorAndExit("Invalid argument count detected!" & @LF & "Count: " & $CmdLine[0])
	EndIf

	$sDest = $CmdLine[1];

	;
	; Did the user specify additional arguments?
	;
	If $CmdLine[0] == 2 Then
		$sFlag = $CmdLine[2]

		If $sFlag == "" Then
			$sFlag = 0; User passed in a blank Arg, reset to default.
		EndIf

		;
		; Does the user want a directory created if it doesn't exist?
		;
		If $sFlag > 8 Then
			;
			; Did the user specify a trailing back slash?
			; It's required when we will create a missing directory.
			; Add it for them if not.
			;
			If (StringRight($sDest, 1) <> "\") Then
				$sDest = $sDest & "\"
			EndIf
		EndIf
	EndIf

	Local $sClipGet = ClipGet() ; Get whatever content is on the clipboard
	;
	; If nothing to copy, no point in going on.
	; We quietly fail because a user might prefer that behavior.
	; TODO: Return an error code which we can then optionally notify the user with.
	;
	If $sClipGet == "" Then
		Exit ; Not considered an error.
	EndIf

	Local $listOfFiles = StringSplit($sClipGet, @LF)

	;
	; Copy 1 or more files to the target directory
	; If the directory doesn't exist, we will create it.
	; Optionally overwrite existing files.
	;
	For $i = 1 To $listOfFiles[0]
		;
		; Sanity check to make sure the file exists
		; and to avoid trying to copy strings which aren't file paths.
		;
		If FileExists($listOfFiles[$i]) Then
			FileCopy($listOfFiles[$i], $sDest, $sFlag)
		EndIf
	Next
EndFunc

Main()
Exit @error